package com.example.gongj;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;

/**
 * 序列化流
 */
public class ObjectOutputStreamDemo {
    public static void main(String[] args) throws Exception {
        FileOutputStream fos = new FileOutputStream("ee.txt");
        ObjectOutputStream oos = new ObjectOutputStream(fos);
        Student student = new Student();
        student.setId(1L);
        student.setName("GOGNJ");
        student.setAge(24);
        oos.writeObject(student);

        oos.close();
        fos.close();
    }
}
